// pages/se-record/se-record.js
const app=getApp()
Page({

    /**
     * 页面的初始数据
     */
    data: {
        display:'none',
        display1:'block'
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
        this.getData()
    },
    getData(){
        var that = this
        wx.request({
            url:`${app.globalData.url}/service1/record1?Uid=`+wx.getStorageSync('Uid'),
            method:'GET',
            header:{"Content-Type":'application/json'},
            success:function(res){
                console.log(111,res.data,res.data.success)
                let result=res.data
                that.setData({
                    list1:result                   
                })
            },
            fail:function(res){
                console.log('request出错')
            }
        })
    },

    onAdoptTap:function(){
        wx.navigateTo({
            url:"/pages/se-question-begin/se-question-begin"
        })
    },
    deleteFoster:function(e){
        console.log(e)
        let fosterid=e.currentTarget.dataset.fid
        console.log(fosterid)
        let that=this
        wx.showModal({
            title:'提示',
            content:'确定要删除吗',
            success:function(res) {
                if(res.confirm){
                    console.log('确定删除')
                    wx.request({
                        url:`${app.globalData.url}/service1/record1/del`,
                        method:'GET',
                        data:{
                            // Uid:10001,
                            Fid:fosterid
                        },
                        success:function(res){
                            that.getData();
                        }
                    })
                    
                }else if(res.cancel){
                    console.log('取消删除')
                }
            }
        })
    },

    onContentTap:function(e){
        let fosterWork = e.currentTarget.dataset.fid
        console.log(e.currentTarget.dataset)

        wx.navigateTo({
            url:'/pages/se-content/se-content?Fid=' + fosterWork
        })
    },

    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function () {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function () {
        this.getData()
    },

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function () {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function () {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function () {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function () {

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function () {

    }
})